Skip to content

Added reactor tests to make check - #6447

Merged
larsewi merged 4 commits into
cfengine:masterfrom
victormlg:cf-reactor.RunTestsInJenkins
Oct 30, 2026
Merged

larsewi merged 4 commits into
cfengine:masterfrom
victormlg:cf-reactor.RunTestsInJenkins

Conversation

@victormlg

Copy link
Copy Markdown
Contributor

No description provided.

@victormlg victormlg changed the title Cf reactor.run tests in jenkins Added reactor tests to make check Oct 27, 2026
@victormlg

Copy link
Copy Markdown
Contributor Author

@cf-bottom jenkins, please :)

@cf-bottom

Copy link
Copy Markdown

Added the reactor tests to jenkins, to be able to run them in jenkins. This
means we can test cf-reactor on all the different platforms.

Signed-off-by: Victor Moene <victor.moene@northern.tech>
Made the logs prettier and added a log file where the xtrace is
printed

Signed-off-by: Victor Moene <victor.moene@northern.tech>
@victormlg
victormlg force-pushed the cf-reactor.RunTestsInJenkins branch from 824257a to 5f352d3 Compare October 28, 2026 11:55
@victormlg

Copy link
Copy Markdown
Contributor Author

Forgot to rebase:

Build Status

The guest environment cannot contain "-". On hosts containing "-", the
promise fails. The host name is now canonofied.

Signed-off-by: Victor Moene <victor.moene@northern.tech>
@victormlg

Copy link
Copy Markdown
Contributor Author

Fixed two bugs:

Build Status

@victormlg
victormlg force-pushed the cf-reactor.RunTestsInJenkins branch from 59bcb95 to 5d02ad6 Compare October 28, 2026 15:19
@larsewi
larsewi marked this pull request as draft October 28, 2026 15:31
@larsewi

larsewi commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Converted to draft while you work on it

The test promised the current user with policy "present" and expected
the promise to be kept. For an existing user, "present" also means
"not locked". When run as root, cf-reactor can read /etc/shadow, and if
the account's password hash starts with '!' (as root's does on some
systems), it is considered locked and gets unlocked. The promise was
then repaired instead of kept, and the test modified the root account.
As a normal user, /etc/shadow is unreadable, so the account was
considered unlocked and the test passed.

Instead, we modify the policy to always return "kept"

Signed-off-by: Victor Moene <victor.moene@northern.tech>
@victormlg
victormlg force-pushed the cf-reactor.RunTestsInJenkins branch from 5d02ad6 to 045402d Compare October 29, 2026 10:47
@victormlg

Copy link
Copy Markdown
Contributor Author

Build Status

@victormlg
victormlg marked this pull request as ready for review October 30, 2026 09:50

@larsewi larsewi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please investigate what happened to the windows acceptance tests. Is it related?

Comment thread tests/reactor/run_test.sh

t=$1

# Explicitly use POSIX tools if needed (Solaris)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't support Solaris anymore.

Comment thread tests/reactor/lib.sh
Comment on lines +13 to +16
# Run command $@ until it succeeds, for at most WAIT_TIMEOUT seconds, polling
# every 0.1 second, or every second where sleep only takes whole seconds.
# Fails if it never succeeded. Runs in a subshell without tracing, so that
# set -x doesn't log every poll.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this a problem on any of the supported platforms?

Comment thread tests/reactor/lib.sh
Comment on lines +33 to +34
# Print the current time in seconds since the Epoch. date +%s is not POSIX;
# without it, srand() seeds with the time of day and returns the last seed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here?

@larsewi

larsewi commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Maybe @craigcomstock can have a look at this too?

@larsewi

larsewi commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Windows test failure is unrelated. I will merge, since it unblocks work. Feel free to review post merge @craigcomstock

@larsewi
larsewi merged commit bc22e81 into cfengine:master Oct 30, 2026
46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants